home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_08 / xmpl_02.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  483 b   |  26 lines  |  [TEXT/R*ch]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 8, example 2
  5.  
  6. -- example of catching
  7.  
  8. module CatchingTest uses ScriptX end
  9. in module CatchingTest
  10.  
  11. global a1:88, b1:0, c1, d1, e1
  12. guard (
  13.     c1 := a1 / b1
  14.     d1 := a1 - b1
  15.     e1 := a1 / c1
  16. )
  17. catching
  18.     divideByZero returnArg: (
  19.         format debug "The number divided by 0 is: %*\n" throwArg @normal
  20.         prin "The default error message is:\n" @unadorned debug
  21.         prinln throwTag throwArg
  22.         caught undefined
  23.     )
  24. end
  25. -->>>
  26.